package models

import (
	"github.com/1l0/identicon"
	"github.com/astaxie/beego"
	"github.com/satori/go.uuid"
)

var imgdic string

func init() {
	imgdic = beego.AppConfig.String("imgdic")
}

func Identicon() (path string, err error) {

	id := identicon.New()
	id.Q=8
	id.Theme=identicon.White
	id.Margin=4
	onlyId := uuid.NewV4().String()
	path=imgdic + "/" + onlyId

	return path + ".png", id.GeneratePNGToFile(beego.AppPath+"/"+path)
}
